(function () {
function __$styleInject(css) {
    var head = document.head || document.getElementsByTagName('head')[0],
        style = document.createElement('style');

    style.type = 'text/css';
    if (style.styleSheet) {
        style.styleSheet.cssText = css || '';
    } else {
        style.appendChild(document.createTextNode(css) || '');
    }
    head.appendChild(style);
}
__$styleInject(".loading-ui{position:fixed;left:0;right:0;top:0;bottom:0;width:100%;height:100%;background:rgba(0,0,0,.6);z-index:99}.loading-ui .loaded{position:absolute;left:0;right:0;top:0;bottom:0;margin:auto}")
}());
(function () {
'use strict';

var $AppConfig = function (Vue, options) {

    var params = { userAccount: null }; //url参数列表
    window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function (str, key, value) {
        if (/\?userAccount=/.test(value)) {
            //解决IOS旧版客户端遗留的问题
            var arr = value.split('?userAccount=');
            value = arr[0];
            params.userAccount = arr[1];
        }
        params[key] = value;
    });
    var getToken = params.access_token;
    var inApp = !!getToken;
    var INTERFACE_HOST = 'http://118.178.236.122:9001/selfdriving/api'; //本地调试 使用mock搭建静态数据服务
    var isIos = /ipod|ipad|iphone|mac os x/i.test(navigator.userAgent);

    Date.prototype.format = function (format) {
        var o = {
            "M+": this.getMonth() + 1, //month
            "d+": this.getDate(), //day
            "h+": this.getHours(), //hour
            "m+": this.getMinutes(), //minute
            "s+": this.getSeconds(), //second
            "q+": Math.floor((this.getMonth() + 3) / 3), //quarter
            "S": this.getMilliseconds() //millisecond
        };

        if (/(y+)/i.test(format)) {
            format = format.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
        }

        for (var k in o) {
            if (new RegExp("(" + k + ")").test(format)) {
                format = format.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
            }
        }
        return format;
    };
    Vue.$AppConfig = Object.assign({
        urlParams: params,
        inApp: inApp,
        isIos: isIos,
        INTERFACE_HOST: INTERFACE_HOST,
        getToken: getToken,
        appJSBridge: function (key, message) {
            if (typeof window.JsBridge == 'object' && typeof window.JsBridge[key] == 'function') {
                message == undefined ? window.JsBridge[key]() : window.JsBridge[key](message);
                return true;
            } else if (typeof window.webkit == 'object') {
                try {
                    message == undefined ? window.webkit.messageHandlers[key].postMessage("") : window.webkit.messageHandlers[key].postMessage(message);
                    return true;
                } catch (e) {
                    console.log(e);
                    return false;
                }
            } else {
                return false;
            }
        }
    }, typeof options === "function" ? options() : options);
};

var alert = { render: function () {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _c('transition', { attrs: { "name": "fade" } }, [_vm.isShow ? _c('div', { staticClass: "ui-mask" }, [_c('div', { staticClass: "alert-ui" }, [_c('div', { staticClass: "alert-ui-top" }, [_vm.title ? _c('h1', { staticClass: "alert-ui-top_title" }, [_vm._v(_vm._s(_vm.title))]) : _vm._e(), _vm._v(" "), _c('div', { staticClass: "alert-ui-top-desc" }, [_c('p', { staticClass: "autd_content", domProps: { "innerHTML": _vm._s(_vm.content) } })])]), _vm._v(" "), _c('div', { staticClass: "alert-ui-footer" }, [_c('a', { staticClass: "alert-ui-footer_btn", attrs: { "href": "javascript:;" }, on: { "click": _vm.btnClick } }, [_vm._v(_vm._s(_vm.btnTitle))])])])]) : _vm._e()]);
    }, staticRenderFns: [],
    name: "alter-ui",
    props: {
        isShow: {
            type: Boolean,
            default: false
        },
        title: {
            type: String,
            default: '提示'
        },
        content: {
            type: String,
            default: '由于网络原因导致预约失败你可以重新预约'
        },
        btnTitle: {
            type: String,
            default: '确定'
        }
    },
    methods: {
        btnClick: function () {
            this.isShow = false;
        }
    }
};

var $vm = void 0;
var alertUI = {
    install: function (Vue) {
        var option = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {
            title: "温馨提示",
            btnTitle: "确定"
        };


        if (!$vm) {
            var Alert = Vue.extend(alert);
            $vm = new Alert({
                el: document.createElement('div')
            });
            document.body.appendChild($vm.$el);
        }
        Vue.$alert = {
            show: function () {
                var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
                    _ref$content = _ref.content,
                    content = _ref$content === undefined ? "" : _ref$content,
                    _ref$title = _ref.title,
                    title = _ref$title === undefined ? "温馨提示" : _ref$title,
                    _ref$btnTitle = _ref.btnTitle,
                    btnTitle = _ref$btnTitle === undefined ? "确定" : _ref$btnTitle;

                this.alertShow(title, content, btnTitle);
            },
            text: function () {
                var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
                var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : option.title;
                var btnTitle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : option.btnTitle;

                this.alertShow(content, title, btnTitle);
            },
            alertShow: function () {
                var content = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
                var title = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : option.title;
                var btnTitle = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : option.btnTitle;

                $vm.isShow = true;
                $vm.title = title;
                $vm.content = content;
                $vm.btnTitle = btnTitle;
            },
            hide: function () {
                $vm.isShow = false;
            }
        };
        Vue.mixin({
            created: function () {
                this.$alert = Vue.$alert;
            }
        });
    }
};

var loading = { render: function () {
        var _vm = this;var _h = _vm.$createElement;var _c = _vm._self._c || _h;return _vm.loading ? _c('div', { staticClass: "loading-ui" }, [_c('div', { staticClass: "loaded", attrs: { "data-loader": "ball-rotate" } })]) : _vm._e();
    }, staticRenderFns: [], _scopeId: 'data-v-4d4d6dc1',
    name: "loading-ui",
    props: {
        loading: {
            type: Boolean,
            default: false
        }
    },
    data: function () {
        return {};
    }
};

var $vm$1 = void 0;
var loadingUI = {
    install: function (Vue, option) {
        if (!$vm$1) {
            var Loading = Vue.extend(loading);
            $vm$1 = new Loading({
                el: document.createElement('div')
            });
            document.body.appendChild($vm$1.$el);
        }
        Vue.$loading = {
            show: function () {
                $vm$1.loading = true;
            },
            hide: function () {
                $vm$1.loading = false;
            }
        };
        Vue.mixin({
            created: function () {
                this.$loading = Vue.$loading;
            }
        });
    }
};

var commonjsGlobal = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};





function createCommonjsModule(fn, module) {
	return module = { exports: {} }, fn(module, module.exports), module.exports;
}

var alloyLever = createCommonjsModule(function (module, exports) {
    /*!
     *  AlloyLever v1.0.2 By dntzhang
     *  Github: https://github.com/AlloyTeam/AlloyLever
     *  MIT Licensed.
     */
    (function (root, factory) {
        module.exports = factory();
    })(commonjsGlobal, function () {
        var AlloyLever = {};
        AlloyLever.settings = {
            cdn: '//s.url.cn/qqun/qun/qqweb/m/qun/confession/js/vconsole.min.js',
            reportUrl: null,
            reportPrefix: '',
            reportKey: 'msg',
            otherReport: null,
            entry: null
        };

        AlloyLever.store = [];

        var methodList = ['log', 'info', 'warn', 'debug', 'error'];
        methodList.forEach(function (item) {
            var method = console[item];

            console[item] = function () {
                AlloyLever.store.push({
                    logType: item,
                    logs: arguments
                });

                method.apply(console, arguments);
            };
        });

        AlloyLever.logs = [];
        AlloyLever.config = function (config) {
            for (var i in config) {
                if (config.hasOwnProperty(i)) {
                    AlloyLever.settings[i] = config[i];
                }
            }

            if (config.entry) {
                window.addEventListener('load', function () {
                    AlloyLever.entry(config.entry);
                });
            }

            var parameter = getParameter('vconsole');

            if (parameter) {
                if (parameter === 'show') {
                    AlloyLever.vConsole(true);
                } else {
                    AlloyLever.vConsole(false);
                }
            }
        };

        AlloyLever.vConsole = function (show) {
            loadScript(AlloyLever.settings.cdn, function () {

                //support vconsole3.0
                if (typeof vConsole === 'undefined') {
                    vConsole = new VConsole({
                        defaultPlugins: ['system', 'network', 'element', 'storage'],
                        maxLogNumber: 5000
                    });
                }

                var i = 0,
                    len = AlloyLever.store.length;

                for (; i < len; i++) {
                    var item = AlloyLever.store[i];
                    //console[item.type].apply(console, item.logs)
                    //prevent twice log
                    item.noOrigin = true;
                    vConsole.pluginList.default.printLog(item);
                }

                if (show) {
                    try {
                        vConsole.show();
                    } catch (e) {}

                    window.addEventListener('load', function () {
                        vConsole.show();
                    });
                }
            });
        };

        AlloyLever.entry = function (selector) {
            var count = 0,
                entry = document.querySelector(selector);
            if (entry) {
                entry.addEventListener('click', function () {
                    count++;
                    if (count > 5) {
                        count = -10000;
                        AlloyLever.vConsole(true);
                    }
                });
            }
        };

        window.onerror = function (msg, url, line, col, error) {
            var newMsg = msg;

            if (error && error.stack) {
                newMsg = processStackMsg(error);
            }

            if (isOBJByType(newMsg, "Event")) {
                newMsg += newMsg.type ? "--" + newMsg.type + "--" + (newMsg.target ? newMsg.target.tagName + "::" + newMsg.target.src : "") : "";
            }

            newMsg = (newMsg + "" || "").substr(0, 500);

            AlloyLever.logs.push({
                msg: newMsg,
                target: url,
                rowNum: line,
                colNum: col
            });

            if (msg.toLowerCase().indexOf('script error') > -1) {
                console.error('Script Error: See Browser Console for Detail');
            } else {
                console.error(newMsg);
            }

            var ss = AlloyLever.settings;
            if (ss.reportUrl) {
                var src = ss.reportUrl + (ss.reportUrl.indexOf('?') > -1 ? '&' : '?') + ss.reportKey + '=' + (ss.reportPrefix ? '[' + ss.reportPrefix + ']' : '') + newMsg + '&t=' + new Date().getTime();
                if (ss.otherReport) {
                    for (var i in ss.otherReport) {
                        if (ss.otherReport.hasOwnProperty(i)) {
                            src += '&' + i + '=' + ss.otherReport[i];
                        }
                    }
                }
                new Image().src = src;
            }
        };

        function loadScript(src, callback) {
            var s, r, t;
            r = false;
            s = document.createElement('script');
            s.type = 'text/javascript';
            s.src = src;
            s.onload = s.onreadystatechange = function () {
                //console.log( this.readyState ); //uncomment this line to see which ready states are called.
                if (!r && (!this.readyState || this.readyState == 'complete')) {
                    r = true;
                    callback();
                }
            };
            t = document.getElementsByTagName('script')[0];
            t.parentNode.insertBefore(s, t);
        }

        function getParameter(n) {
            var m = window.location.hash.match(new RegExp('(?:#|&)' + n + '=([^&]*)(&|$)')),
                result = !m ? '' : decodeURIComponent(m[1]);
            return result || getParameterByName(n);
        }

        function getParameterByName(name, url) {
            if (!url) url = window.location.href;
            name = name.replace(/[\[\]]/g, "\\$&");
            var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"),
                results = regex.exec(url);
            if (!results) return null;
            if (!results[2]) return '';
            return decodeURIComponent(results[2].replace(/\+/g, " "));
        }

        function isOBJByType(o, type) {
            return Object.prototype.toString.call(o) === "[object " + (type || "Object") + "]";
        }

        function processStackMsg(error) {
            var stack = error.stack.replace(/\n/gi, "").split(/\bat\b/).slice(0, 9).join("@").replace(/\?[^:]+/gi, "");
            var msg = error.toString();
            if (stack.indexOf(msg) < 0) {
                stack = msg + "@" + stack;
            }
            return stack;
        }

        function getCookie(name) {
            var arr,
                reg = new RegExp("(^| )" + name + "=([^;]*)(;|$)");

            if (arr = document.cookie.match(reg)) return unescape(arr[2]);else return null;
        }

        AlloyLever.getCookie = getCookie;
        AlloyLever.getParameter = getParameter;
        AlloyLever.loadScript = loadScript;

        return AlloyLever;
    });
});

alloyLever.config({
    entry: "#invitation" //请点击这个DOM元素6次召唤vConsole。//你可以通过AlloyLever.entry('#entry2')设置多个机关入 召唤神龙
});

if (window.Vue) {
    Vue.use($AppConfig, {});
    Vue.use(alertUI);
    Vue.use(loadingUI);

    var vm = new Vue({
        el: '#invitation',
        data: {
            code: '',
            inApp: Vue.$AppConfig.inApp,
            access_token: Vue.$AppConfig.getToken,
            dom: HTMLDivElement,
            animId: null
        },
        methods: {
            focus: function () {
                var _this = this;

                setTimeout(function () {
                    _this.scrollTop(_this.dom);
                }, 500);
            },
            scrollTop: function (dom) {
                var _this2 = this;

                clearInterval(this.animId);
                this.animId = setInterval(function () {
                    var height = dom.clientHeight;
                    var scrHeight = dom.scrollHeight;
                    var scrTop = dom.scrollTop;
                    if (scrTop + height >= scrHeight) {
                        clearInterval(_this2.animId);
                        // document.body.scrollTop = document.documentElement.scrollTop = scrHeight;
                    } else {
                        scrTop += 1;
                        dom.scrollTop = scrTop;
                    }
                }, 60 / 1000);
            },
            upServer: function () {
                var _this3 = this;

                // 提交邀请码到服务器
                if (!this.inApp) {
                    this.$loading.hide();
                    return this.$alert.text("请在APP内打开");
                }
                if (this.trim(this.code).length < 8) {
                    return this.$alert.text("请输入正确邀请码");
                }
                // ajax 提交
                var body = { access_token: this.access_token, invitationCode: this.code };

                this.$http.post(Vue.$AppConfig.INTERFACE_HOST + "/useInvitationCode", body, { emulateJSON: true }).then(function (response) {
                    _this3.$loading.hide();
                    var body = response.body;
                    _this3.appCallback(body);
                    if (body.success) {
                        // 邀请成功，返回上一页
                        Vue.$AppConfig.appJSBridge('keyBack');
                    } else {
                        // 弹窗提示错误
                        _this3.$alert.text(body.text);
                    }
                }, function () {
                    _this3.$loading.hide();
                    _this3.$alert.text("网络连接错误,请稍后再试");
                });
            },
            trim: function (str) {
                return str.replace(/(^\s*)|(\s*$)/g, "");
            },
            appCallback: function (body) {
                var state = true;
                if (!body.success) {
                    state = false;
                }
                if (Vue.$AppConfig.appJSBridge('inviteFlag', state)) {} else {
                    console.log("邀请回调失败");
                }

                // if (Vue.$AppConfig.isIos) {
                //     try {
                //         window.webkit.messageHandlers.inviteFlag.postMessage(state);
                //     } catch (e) {
                //         console.log(e);
                //         this.$alert.text("没找到inviteFlag");
                //     }
                // } else {
                //     try {
                //         window.JsBridge.inviteFlag(state);
                //     } catch (e) {
                //         console.log(e);
                //         this.$alert.text("没找到inviteFlag");
                //     }
                // }
            }
        },
        mounted: function () {
            var _this4 = this;

            if (Vue.$AppConfig.isIos) {
                this.dom = document.body;
            } else {
                this.dom = this.$refs.inv;
            }

            window.addEventListener('resize', function () {
                _this4.scrollTop(_this4.dom);
            });
        }

    });
}

}());
